//
//  LGHomeCell.m
//  微博
//
//  Created by MS on 15-12-14.
//  Copyright (c) 2015年 MS. All rights reserved.
//

#import "LGHomeCell.h"
#import "LGRetSweetView.h"
#import "LGStatusToolBarView.h"
#import "LGOriginalView.h"

@interface LGHomeCell ()
@property (nonatomic,weak) LGStatusToolBarView * statusToolBarView;
@property (nonatomic,weak) LGOriginalView * originalView;
@property (nonatomic,weak) LGRetSweetView * retSweetView;
@end

@implementation LGHomeCell

+(instancetype)cellWithTableView:(UITableView *)tableView
{
    NSString * className = NSStringFromClass([self class]);
    
    [tableView registerClass:[self class] forCellReuseIdentifier:className];
    
    return [tableView dequeueReusableCellWithIdentifier:className];
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
       
        [self setUpAllsubView];
        
    }
    
    return self;
}

-(void)setUpAllsubView
{
    //添加原始微博视图
    LGOriginalView * originalView =  [[LGOriginalView alloc] init];
    [self addSubview:originalView];
    _originalView = originalView;
    
    //添加转发视图
    LGRetSweetView * retSweetView = [[LGRetSweetView alloc] init];
    [self addSubview:retSweetView];
    _retSweetView = retSweetView;
    
    
    //添加工具条
    LGStatusToolBarView * statusToolBarView = [[LGStatusToolBarView alloc] init];
    [self addSubview:statusToolBarView];
    _statusToolBarView = statusToolBarView;
    
    
}

-(void)setStatusF:(LGStutaesFrame *)statusF
{
    _statusF = statusF;
    
    // 设置原创微博frame
    _originalView.frame = statusF.originalViewFrame;
    _originalView.statusF = statusF;
    
    // 设置转发微博frame
        _retSweetView.frame = statusF.retSweetViewFrame;
        _retSweetView.statusF = statusF;

    // 设置工具条frame
    _statusToolBarView.frame = statusF.ToolBarFrame;
    _statusToolBarView.status = statusF.statues;
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    // Configure the view for the selected state
}

@end
